<%@ page import="com.ecomm.util.Config,
                 com.ecomm.util.DB,
                 com.ecomm.orgmodel.OrgModelTreeUtil"%>
<%@page contentType="text/html;charset=utf-8"%>

<%@include file="/include/pageexpires.jsp"%>
<%@include file="/include/currentuserinfo.jsp"%>
<%@include file="/include/filepath.jsp"%>


<html xmlns:ecomm>
<head>
<title>组织机构列表</title>
<script language="javascript">
function check(form){
	var subGo=0;
    var list="";
	 for(var i=0;i<form.elements.length;i++)
	 {
     if(form.elements[i].type=="radio"||form.elements[i].type=="checkbox")
		 {
			if(form.elements[i].checked)
			{
			  subGo++;
              list+=form.elements[i].value+";";
			}
		 }
   }

   if(subGo<1)
   	{
		  alert("您没有选择部门！");
		  return false;
	}

   else if((form.action.value=="OutplaceUser")&&(subGo>1))
   	{
		  alert("调职只能选择一个部门");
		  return false;
	}

      form.orglist.value=list;
}

</script>
<style type="text/css">
ecomm\:tree
{
    behavior:url('<%=currentStylePath%>tree/tree51.htc');
}
</style>
<link type="text/css" rel="stylesheet" href="<%=currentSkinCss%>" id="menuStyleSheet">
<script type="text/javascript" src="<%=ctxpath%>/themes/newstyle/javascript/menu3.js"></script>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<%
    String action = request.getParameter("action");
    //used by moonlight
	String orgID = request.getParameter("orgid");
    //used by outplace
    String oldOrgID = request.getParameter("oldorgid");
	String userID = request.getParameter("userid");
%>

<body  topmargin="0" leftmargin="0" bgcolor="#ffffff" id="leftbody" bgproperties="fixed" scroll="auto">
<%
    if("OutplaceUser".equals(action)){
%>
<form action="<%=ctxpath%>/orgmodel/orgmodelmngaction.do" method="post" onsubmit=" return check(this)" target="frmCenter">
  <input type="hidden" name="action" value="OutplaceUser">
   <input type="hidden" name="orgid" value="<%=oldOrgID%>">
   <input type="hidden" name="userid" value="<%=userID%>">
  <%}else if("Moonlight".equals(action)){%>
 <form action="<%=ctxpath%>/orgmodel/orgmodelmngaction.do" method="post" onsubmit="return check(this)" target="frmCenter">
 <input type="hidden" name="action" value="Moonlight">
  <input type="hidden" name="userid" value="<%=userID%>">
  <input type="hidden" name="orgid" value="<%=orgID%>">
 <%
       }
 %>
  <input type="hidden" name="orglist" value="">

<table width="100%" height="100%" border="0" cellpadding="0" cellspacing="0" class="tree" align="center">
  <tr>
    <td valign="top" nowrap class="tree_td_top"><br><br>
<%--	<table width="100%"  border="0" cellpadding="0" cellspacing="0" class="tree_top">--%>
<%--        <tr>--%>
<%--          <td valign="top" nowrap >请选择部门</td>--%>
<%----%>
<%--        </tr>--%>
<%--      </table>--%>
      <table width="100%"  border="0" cellpadding="0" cellspacing="0" class="tree_middle">
        <tr>
          <td class="left"><img src="<%=currentStylePath%>tree/left_txt.gif"></td>
          <td valign="top" nowrap class="middle">
<%
    String id=request.getParameter("id");
    DB db=null;
    try
    {
        db= DBFactory.getDBInstance();
        OrgModelTreeUtil orgTree=new OrgModelTreeUtil(db);
        out.println(orgTree.dumpSelectOrgTree("",ctxpath+"/orgmodel/right.jsp",false,ctxpath));
    }
    catch(Exception e)
    {
    }
    finally
    {
        if(db!=null)
            db.close();
    }

%>
          </td>
          <td class="right"></td>
        </tr>
      </table>
      </td>
  </tr>
  <tr>
      <td valign="bottom" nowrap class="tree_td_bottom" align="center">
        <input type="submit" value="提交" Class="button">
        <input type="button" value="返回"  Class="button" onclick="parent.hiddenDiv();"/>
      </td>
  </tr>
</table>

</form>
</body>
</html>
